﻿using System;
using System.Data;
using Model;
using DBUtility;

namespace DAL
{
     /// <summary>
     /// 数据访问层OUTLOOK_CHASISS_SUBITEM_DAL
     /// </summary>
     public class OUTLOOK_CHASISS_SUBITEM_DAL
     {
         public OUTLOOK_CHASISS_SUBITEM_DAL()
         {
         }


         /// <summary>
         /// 得到最大ID
         /// </summary>
         public int GetMax_ID(string p_strWhere)
         {
             int intResult = 0;
             string strSql = "select max(ID) as m from OUTLOOK_CHASISS_SUBITEM";

             if(p_strWhere.Trim().Length > 0)
             {
                 strSql += " where " + p_strWhere;
             }

             DataTable dtTemp = new DataTable();
             DbHelper.GetTable(strSql, ref dtTemp);

             if(dtTemp.Rows.Count>0)
             {
                 if(dtTemp.Rows[0]["m"].ToString().Length>0)
                 {
                     intResult = dtTemp.Rows[0]["m"] == DBNull.Value ? 0 : Convert.ToInt32(dtTemp.Rows[0]["m"]);
                 }
             }

             dtTemp.Dispose();

             return intResult + 1;

          }

          /// <summary>
          /// 得到最大ID
          /// </summary>
          public int GetMax_ID()
          {
              return GetMax_ID("");
          }


          /// <summary>
          /// 判断数据是否存在
          /// </summary>
          public bool Exists(int intID)
          {
               bool bolResult = false;


               string strSql = "";
               strSql += "select count(1) as c from OUTLOOK_CHASISS_SUBITEM";
               strSql += " where ";
               strSql += " ID='"+ intID +"'";

               DataTable dtTemp = new DataTable();
               DbHelper.GetTable(strSql, ref dtTemp);

               if (dtTemp.Rows.Count > 0)
               {
                   bolResult = Convert.ToInt32(dtTemp.Rows[0]["c"]) > 0;
               }

               dtTemp.Dispose();

               return bolResult;

          }

          /// <summary>
          /// 获取数据总记录数
          /// </summary>
          public int GetRecordCount(string p_strWhere)
          {
              int intResult=0;

              string strSql = "";
              strSql += "select count(1) as c from OUTLOOK_CHASISS_SUBITEM";
              if(p_strWhere.Trim().Length > 0)
              {
                 strSql += " where " + p_strWhere;
              }

              DataTable dtTemp = new DataTable();
              DbHelper.GetTable(strSql, ref dtTemp);

              if(dtTemp.Rows.Count>0)
              {
                  intResult=Convert.ToInt32(dtTemp.Rows[0]["c"]);
              }

              dtTemp.Dispose();

              return intResult;
          }

          /// <summary>
          /// 获取数据总记录数
          /// </summary>
          public int GetRecordCount()
          {
              return GetRecordCount("");
          }

          /// <summary>
          /// 获取数据分页总数
           /// </summary>
          public int GetPageCount(string p_strWhere, int p_intPageSize)
          {
              int intResult=0;

              if(p_intPageSize > 0)
              {
                  int intRecordCount = GetRecordCount(p_strWhere);
                  intResult = Convert.ToInt32(Math.Truncate(Convert.ToDecimal(intRecordCount) / Convert.ToDecimal(p_intPageSize)));
                  if (intRecordCount > (intResult * p_intPageSize))
                  {
                       intResult++;
                  }
              }

              if(intResult == 0)
              {
                   intResult++;
              }
              return intResult;
           }

          /// <summary>
          /// 获取数据分页总数
          /// </summary>
          public int GetPageCount(int p_intPageSize)
          {
              return GetPageCount("", p_intPageSize);
          }

          /// <summary>
          /// 添加一条数据 SQL
          /// </summary>
          public string InsertSQL(OUTLOOK_CHASISS_SUBITEM model)
          {
              string strFieldSQL = "";
              string strValueSQL = "";

              if(model.Changed("ID") == true && model.ID != null)
              {
                   strFieldSQL += ",ID";
                   strValueSQL += "," + model.ID + "";
              }

              if(model.Changed("MID") == true && model.MID != null)
              {
                   strFieldSQL += ",MID";
                   strValueSQL += "," + model.MID + "";
              }

              if(model.Changed("MNAME") == true && model.MNAME != null)
              {
                   strFieldSQL += ",MNAME";
                   strValueSQL += ",'" + model.MNAME.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("SUBID") == true && model.SUBID != null)
              {
                   strFieldSQL += ",SUBID";
                   strValueSQL += "," + model.SUBID + "";
              }

              if(model.Changed("SNAME") == true && model.SNAME != null)
              {
                   strFieldSQL += ",SNAME";
                   strValueSQL += ",'" + model.SNAME.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("JUDGECLASS") == true && model.JUDGECLASS != null)
              {
                   strFieldSQL += ",JUDGECLASS";
                   strValueSQL += ",'" + model.JUDGECLASS.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("APPLYCLASS") == true && model.APPLYCLASS != null)
              {
                   strFieldSQL += ",APPLYCLASS";
                   strValueSQL += ",'" + model.APPLYCLASS.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("MITEMID") == true && model.MITEMID != null)
              {
                   strFieldSQL += ",MITEMID";
                   strValueSQL += "," + model.MITEMID + "";
              }

              if(model.Changed("MITEMNAME") == true && model.MITEMNAME != null)
              {
                   strFieldSQL += ",MITEMNAME";
                   strValueSQL += ",'" + model.MITEMNAME.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("IsItemValid") == true && model.IsItemValid != null)
              {
                   strFieldSQL += ",IsItemValid";
                   strValueSQL += "," + model.IsItemValid + "";
              }

              if(model.Changed("JSDJPDNUM") == true && model.JSDJPDNUM != null)
              {
                   strFieldSQL += ",JSDJPDNUM";
                   strValueSQL += "," + model.JSDJPDNUM + "";
              }

              if(model.Changed("JSDJPDType") == true && model.JSDJPDType != null)
              {
                   strFieldSQL += ",JSDJPDType";
                   strValueSQL += "," + model.JSDJPDType + "";
              }

              string strSql = "";
              strSql += "insert into OUTLOOK_CHASISS_SUBITEM";
              strSql += "(";
              strSql += strFieldSQL.Substring(1);
              strSql += ")";
              strSql += " values";
              strSql += "(";
              strSql += strValueSQL.Substring(1);
              strSql += ")";

              return strSql;
          }

          /// <summary>
          /// 添加一条数据
          /// </summary>
          public bool Insert(OUTLOOK_CHASISS_SUBITEM model)
          {
              return DbHelper.ExecuteSql(InsertSQL(model));
          }

          /// <summary>
          /// 修改一条数据 SQL
          /// </summary>
          public string UpdateSQL(OUTLOOK_CHASISS_SUBITEM model,int intID)
          {
              string strUpdateSQL = "";

              if(model.Changed("ID") == true && model.ID != null)
              {
                  strUpdateSQL += ",ID=" + model.ID + "";
              }

              if(model.Changed("MID") == true && model.MID != null)
              {
                  strUpdateSQL += ",MID=" + model.MID + "";
              }

              if(model.Changed("MNAME") == true && model.MNAME != null)
              {
                  strUpdateSQL += ",MNAME='" + model.MNAME.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("SUBID") == true && model.SUBID != null)
              {
                  strUpdateSQL += ",SUBID=" + model.SUBID + "";
              }

              if(model.Changed("SNAME") == true && model.SNAME != null)
              {
                  strUpdateSQL += ",SNAME='" + model.SNAME.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("JUDGECLASS") == true && model.JUDGECLASS != null)
              {
                  strUpdateSQL += ",JUDGECLASS='" + model.JUDGECLASS.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("APPLYCLASS") == true && model.APPLYCLASS != null)
              {
                  strUpdateSQL += ",APPLYCLASS='" + model.APPLYCLASS.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("MITEMID") == true && model.MITEMID != null)
              {
                  strUpdateSQL += ",MITEMID=" + model.MITEMID + "";
              }

              if(model.Changed("MITEMNAME") == true && model.MITEMNAME != null)
              {
                  strUpdateSQL += ",MITEMNAME='" + model.MITEMNAME.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("IsItemValid") == true && model.IsItemValid != null)
              {
                  strUpdateSQL += ",IsItemValid=" + model.IsItemValid + "";
              }

              if(model.Changed("JSDJPDNUM") == true && model.JSDJPDNUM != null)
              {
                  strUpdateSQL += ",JSDJPDNUM=" + model.JSDJPDNUM + "";
              }

              if(model.Changed("JSDJPDType") == true && model.JSDJPDType != null)
              {
                  strUpdateSQL += ",JSDJPDType=" + model.JSDJPDType + "";
              }

               string strSql = "";
               strSql += "update OUTLOOK_CHASISS_SUBITEM set ";
               strSql += strUpdateSQL.Substring(1);
               strSql += " where ";
               strSql += " ID="+ intID +"";

               return strSql;
          }

          /// <summary>
          /// 修改一条数据
          /// </summary>
          public bool Update(OUTLOOK_CHASISS_SUBITEM model, int intID)
          {
              return DbHelper.ExecuteSql(UpdateSQL(model, intID));
          }

          /// <summary>
          /// 修改一个集合 SQL
          /// </summary>
           public string UpdateRangeSQL(OUTLOOK_CHASISS_SUBITEM model, string p_strWhere)
          {
               string strUpdateSQL = "";

               if(model.Changed("ID") == true && model.ID != null)
               {
                  strUpdateSQL += ",ID=" + model.ID + "";
               }

               if(model.Changed("MID") == true && model.MID != null)
               {
                  strUpdateSQL += ",MID=" + model.MID + "";
               }

               if(model.Changed("MNAME") == true && model.MNAME != null)
               {
                  strUpdateSQL += ",MNAME='" + model.MNAME.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("SUBID") == true && model.SUBID != null)
               {
                  strUpdateSQL += ",SUBID=" + model.SUBID + "";
               }

               if(model.Changed("SNAME") == true && model.SNAME != null)
               {
                  strUpdateSQL += ",SNAME='" + model.SNAME.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("JUDGECLASS") == true && model.JUDGECLASS != null)
               {
                  strUpdateSQL += ",JUDGECLASS='" + model.JUDGECLASS.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("APPLYCLASS") == true && model.APPLYCLASS != null)
               {
                  strUpdateSQL += ",APPLYCLASS='" + model.APPLYCLASS.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("MITEMID") == true && model.MITEMID != null)
               {
                  strUpdateSQL += ",MITEMID=" + model.MITEMID + "";
               }

               if(model.Changed("MITEMNAME") == true && model.MITEMNAME != null)
               {
                  strUpdateSQL += ",MITEMNAME='" + model.MITEMNAME.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("IsItemValid") == true && model.IsItemValid != null)
               {
                  strUpdateSQL += ",IsItemValid=" + model.IsItemValid + "";
               }

               if(model.Changed("JSDJPDNUM") == true && model.JSDJPDNUM != null)
               {
                  strUpdateSQL += ",JSDJPDNUM=" + model.JSDJPDNUM + "";
               }

               if(model.Changed("JSDJPDType") == true && model.JSDJPDType != null)
               {
                  strUpdateSQL += ",JSDJPDType=" + model.JSDJPDType + "";
               }

              string strSql = "";
              strSql += "update OUTLOOK_CHASISS_SUBITEM set ";
              strSql += strUpdateSQL.Substring(1);
              strSql += " where " + p_strWhere;

              return strSql;
          }

          /// <summary>
          /// 修改一个集合
          /// </summary>
          public bool UpdateRange(OUTLOOK_CHASISS_SUBITEM model, string p_strWhere)
          {
              return DbHelper.ExecuteSql(UpdateRangeSQL(model, p_strWhere));
          }

          /// <summary>
          /// 修改全部数据 SQL
          /// </summary>
          public string UpdateAllSQL(OUTLOOK_CHASISS_SUBITEM model)
          {
              string strUpdateSQL = "";

                  strUpdateSQL += ",ID=" + model.ID + "";
                  strUpdateSQL += ",MID=" + model.MID + "";
                  strUpdateSQL += ",MNAME='" + model.MNAME.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",SUBID=" + model.SUBID + "";
                  strUpdateSQL += ",SNAME='" + model.SNAME.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",JUDGECLASS='" + model.JUDGECLASS.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",APPLYCLASS='" + model.APPLYCLASS.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",MITEMID=" + model.MITEMID + "";
                  strUpdateSQL += ",MITEMNAME='" + model.MITEMNAME.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",IsItemValid=" + model.IsItemValid + "";
                  strUpdateSQL += ",JSDJPDNUM=" + model.JSDJPDNUM + "";
                  strUpdateSQL += ",JSDJPDType=" + model.JSDJPDType + "";


               string strSql = "";
               strSql += "update OUTLOOK_CHASISS_SUBITEM set ";
               strSql += strUpdateSQL.Substring(1);

               return strSql;

          }

          /// <summary>
          /// 修改全部数据
          /// </summary>
          public bool UpdateAll(OUTLOOK_CHASISS_SUBITEM model)
          {
              return DbHelper.ExecuteSql(UpdateAllSQL(model));
          }

          /// <summary>
          /// 删除一条数据 SQL
          /// </summary>
          public string DeleteSQL(int intID)
          {
              string strSql = "";
              strSql += "delete from OUTLOOK_CHASISS_SUBITEM";
              strSql += " where ";
               strSql += " ID="+ intID +"";

              return strSql;

          }

          /// <summary>
          /// 删除一条数据
          /// </summary>
          public bool Delete(int intID)
          {
              return DbHelper.ExecuteSql(DeleteSQL(intID));
          }

          /// <summary>
          /// 删除一个集合 SQL
          /// </summary>
          public string DeleteRangeSQL(string p_strWhere)
          {
              string strSql = "";
              strSql += "delete from OUTLOOK_CHASISS_SUBITEM";
              strSql += " where " + p_strWhere;

              return strSql;
           }

          /// <summary>
          /// 删除一个集合
          /// </summary>
          public bool DeleteRange(string p_strWhere)
          {
              return DbHelper.ExecuteSql(DeleteRangeSQL(p_strWhere));
          }

          /// <summary>
          /// 删除全部 SQL
          /// </summary>
          public string DeleteAllSQL()
          {
              string strSql = "";
              strSql += "delete from OUTLOOK_CHASISS_SUBITEM";

              return strSql;
           }

         /// <summary>
         /// 删除全部
         /// </summary>
         public bool DeleteAll()
         {
             return DbHelper.ExecuteSql(DeleteAllSQL());
         }

          /// <summary>
         /// 得到一个对象实体
         /// </summary>
         public OUTLOOK_CHASISS_SUBITEM GetModel(int intID)
         {
             string strSql = "";
             strSql += "select * from OUTLOOK_CHASISS_SUBITEM";
             strSql += " where ";
               strSql += " ID="+ intID +"";

             DataTable dtTemp = new DataTable();
             DbHelper.GetTable(strSql, ref dtTemp);

             OUTLOOK_CHASISS_SUBITEM model = new OUTLOOK_CHASISS_SUBITEM();

             if(dtTemp.Rows.Count>0)
             {
                 model = new OUTLOOK_CHASISS_SUBITEM();

                 model.ID = dtTemp.Rows[0]["ID"] == DBNull.Value ? 0 : Convert.ToInt32(dtTemp.Rows[0]["ID"]);
                 model.MID = dtTemp.Rows[0]["MID"] == DBNull.Value ? 0 : Convert.ToInt32(dtTemp.Rows[0]["MID"]);
                 model.MNAME = dtTemp.Rows[0]["MNAME"] == DBNull.Value ? "" : dtTemp.Rows[0]["MNAME"].ToString();
                 model.SUBID = dtTemp.Rows[0]["SUBID"] == DBNull.Value ? 0 : Convert.ToInt32(dtTemp.Rows[0]["SUBID"]);
                 model.SNAME = dtTemp.Rows[0]["SNAME"] == DBNull.Value ? "" : dtTemp.Rows[0]["SNAME"].ToString();
                 model.JUDGECLASS = dtTemp.Rows[0]["JUDGECLASS"] == DBNull.Value ? "" : dtTemp.Rows[0]["JUDGECLASS"].ToString();
                 model.APPLYCLASS = dtTemp.Rows[0]["APPLYCLASS"] == DBNull.Value ? "" : dtTemp.Rows[0]["APPLYCLASS"].ToString();
                 model.MITEMID = dtTemp.Rows[0]["MITEMID"] == DBNull.Value ? 0 : Convert.ToInt32(dtTemp.Rows[0]["MITEMID"]);
                 model.MITEMNAME = dtTemp.Rows[0]["MITEMNAME"] == DBNull.Value ? "" : dtTemp.Rows[0]["MITEMNAME"].ToString();
                 model.IsItemValid = dtTemp.Rows[0]["IsItemValid"] == DBNull.Value ? 0 : Convert.ToInt32(dtTemp.Rows[0]["IsItemValid"]);
                 model.JSDJPDNUM = dtTemp.Rows[0]["JSDJPDNUM"] == DBNull.Value ? 0 : Convert.ToInt32(dtTemp.Rows[0]["JSDJPDNUM"]);
                 model.JSDJPDType = dtTemp.Rows[0]["JSDJPDType"] == DBNull.Value ? 0 : Convert.ToInt32(dtTemp.Rows[0]["JSDJPDType"]);
             }

             dtTemp.Dispose();

             return model;
         }

         /// <summary>
         /// 得到一个对象实体
         /// </summary>
         public void GetModel(ref DataTable p_dtData, int intID)
         {
             p_dtData.Clear();

             string strSql = "";
             strSql += "select * from OUTLOOK_CHASISS_SUBITEM";
             strSql += " where ";
               strSql += " ID="+ intID +"";

              DbHelper.GetTable(strSql, ref p_dtData);
         }

      /// <summary>
      /// 得到对象集合
      /// </summary>
      public OUTLOOK_CHASISS_SUBITEM[] GetModelList(string p_strWhere, string p_strOrder, int p_intPageNumber, int p_intPageSize)
      {
          int m_intPageNumber = p_intPageNumber;
          int m_intPageCount = GetPageCount(p_strWhere, p_intPageSize);

          if((m_intPageNumber < 1) || (m_intPageNumber == 0))
          {
               m_intPageNumber = 1;
          }

          if(m_intPageNumber == -1)
          {
               m_intPageNumber = m_intPageCount;
          }

          if(m_intPageNumber > m_intPageCount)
          {
               m_intPageNumber = m_intPageCount;
          }

          string strSql = "";
          strSql += "select * from OUTLOOK_CHASISS_SUBITEM";
          if(p_strWhere.Trim().Length > 0)
          {
               strSql += " where " + p_strWhere;
          }
          if(p_strOrder.Trim().Length > 0)
          {
               strSql += " order by " + p_strOrder;
          }

          DataTable dtTemp = new DataTable();

          if(p_intPageSize > 0)
          {
               DbHelper.GetTable(strSql, ref dtTemp, (m_intPageNumber-1)*p_intPageSize, p_intPageSize);
          }
          else
          {
               DbHelper.GetTable(strSql, ref dtTemp);
          }

          OUTLOOK_CHASISS_SUBITEM[] arrModel=new OUTLOOK_CHASISS_SUBITEM[dtTemp.Rows.Count];

          for(int N=0;N<dtTemp.Rows.Count;N++)
          {
               arrModel[N] = new OUTLOOK_CHASISS_SUBITEM();

                 arrModel[N].ID = dtTemp.Rows[N]["ID"] == DBNull.Value ? 0 : Convert.ToInt32(dtTemp.Rows[N]["ID"]);
                 arrModel[N].MID = dtTemp.Rows[N]["MID"] == DBNull.Value ? 0 : Convert.ToInt32(dtTemp.Rows[N]["MID"]);
                 arrModel[N].MNAME = dtTemp.Rows[N]["MNAME"] == DBNull.Value ? "" : dtTemp.Rows[N]["MNAME"].ToString();
                 arrModel[N].SUBID = dtTemp.Rows[N]["SUBID"] == DBNull.Value ? 0 : Convert.ToInt32(dtTemp.Rows[N]["SUBID"]);
                 arrModel[N].SNAME = dtTemp.Rows[N]["SNAME"] == DBNull.Value ? "" : dtTemp.Rows[N]["SNAME"].ToString();
                 arrModel[N].JUDGECLASS = dtTemp.Rows[N]["JUDGECLASS"] == DBNull.Value ? "" : dtTemp.Rows[N]["JUDGECLASS"].ToString();
                 arrModel[N].APPLYCLASS = dtTemp.Rows[N]["APPLYCLASS"] == DBNull.Value ? "" : dtTemp.Rows[N]["APPLYCLASS"].ToString();
                 arrModel[N].MITEMID = dtTemp.Rows[N]["MITEMID"] == DBNull.Value ? 0 : Convert.ToInt32(dtTemp.Rows[N]["MITEMID"]);
                 arrModel[N].MITEMNAME = dtTemp.Rows[N]["MITEMNAME"] == DBNull.Value ? "" : dtTemp.Rows[N]["MITEMNAME"].ToString();
                 arrModel[N].IsItemValid = dtTemp.Rows[N]["IsItemValid"] == DBNull.Value ? 0 : Convert.ToInt32(dtTemp.Rows[N]["IsItemValid"]);
                 arrModel[N].JSDJPDNUM = dtTemp.Rows[N]["JSDJPDNUM"] == DBNull.Value ? 0 : Convert.ToInt32(dtTemp.Rows[N]["JSDJPDNUM"]);
                 arrModel[N].JSDJPDType = dtTemp.Rows[N]["JSDJPDType"] == DBNull.Value ? 0 : Convert.ToInt32(dtTemp.Rows[N]["JSDJPDType"]);
          }

          dtTemp.Dispose();

          return arrModel;
      }

      /// <summary>
      /// 得到对象集合
      /// </summary>
      public OUTLOOK_CHASISS_SUBITEM[] GetModelList(string p_strWhere)
      {
          return GetModelList(p_strWhere, "", -1, -1);
      }

      /// <summary>
      /// 得到对象集合
      /// </summary>
      public OUTLOOK_CHASISS_SUBITEM[] GetModelList(string p_strWhere, string p_strOrder)
      {
          return GetModelList(p_strWhere, p_strOrder, -1, -1);
      }

      /// <summary>
      /// 得到对象集合
      /// </summary>
      public OUTLOOK_CHASISS_SUBITEM[] GetModelList(int p_intPageNumber, int p_intPageSize)
      {
          return GetModelList("", "", p_intPageNumber, p_intPageSize);
      }

      /// <summary>
      /// 得到对象集合
      /// </summary>
      public OUTLOOK_CHASISS_SUBITEM[] GetModelList(string p_strWhere, int p_intPageNumber, int p_intPageSize)
      {
          return GetModelList(p_strWhere, "", p_intPageNumber, p_intPageSize);
      }

      /// <summary>
      /// 得到对象集合
      /// </summary>
      public OUTLOOK_CHASISS_SUBITEM[] GetModelList()
      {
          return GetModelList("", "", -1, -1);
      }

      /// <summary>
      /// 得到对象集合
      /// </summary>
      public void GetModelList(ref DataTable p_dtData, string p_strWhere, string p_strOrder, int p_intPageNumber, int p_intPageSize)
      {
          p_dtData.Clear();

          int m_intPageNumber = p_intPageNumber;
          int m_intPageCount = GetPageCount(p_strWhere, p_intPageSize);

          if((m_intPageNumber < 1) || (m_intPageNumber == 0))
          {
              m_intPageNumber = 1;
          }

          if(m_intPageNumber == -1)
          {
              m_intPageNumber = m_intPageCount;
          }

          if(m_intPageNumber > m_intPageCount)
          {
              m_intPageNumber = m_intPageCount;
          }

          string strSql = "";
          strSql += "select * from OUTLOOK_CHASISS_SUBITEM";
          if(p_strWhere.Trim().Length > 0)
          {
              strSql += " where " + p_strWhere;
          }
          if(p_strOrder.Trim().Length > 0)
          {
              strSql += " order by " + p_strOrder;
          }

          if(p_intPageSize > 0)
          {
              DbHelper.GetTable(strSql, ref p_dtData, (m_intPageNumber-1)*p_intPageSize, p_intPageSize);
          }
          else
          {
              DbHelper.GetTable(strSql, ref p_dtData);
          }
       }

       /// <summary>
       /// 得到对象集合
       /// </summary>
       public void GetModelList(ref DataTable p_dtData, string p_strWhere)
       {
           GetModelList(ref p_dtData, p_strWhere, "", -1, -1);
       }

       /// <summary>
       /// 得到对象集合
       /// </summary>
       public void GetModelList(ref DataTable p_dtData, string p_strWhere, string p_strOrder)
       {
           GetModelList(ref p_dtData, p_strWhere, p_strOrder, -1, -1);
       }

       /// <summary>
       /// 得到对象集合
       /// </summary>
       public void GetModelList(ref DataTable p_dtData, int p_intPageNumber, int p_intPageSize)
       {
           GetModelList(ref p_dtData, "", "", p_intPageNumber, p_intPageSize);
       }

       /// <summary>
       /// 得到对象集合
       /// </summary>
       public void GetModelList(ref DataTable p_dtData, string p_strWhere, int p_intPageNumber, int p_intPageSize)
       {
           GetModelList(ref p_dtData, p_strWhere, "", p_intPageNumber, p_intPageSize);
       }
       /// <summary>
       /// 得到对象集合
       /// </summary>
       public void GetModelList(ref DataTable p_dtData)
       {
           GetModelList(ref p_dtData, "", "", -1, -1);
       }
   }
}
